<template>
    <div class="body">
        <div class="top">
            <div class="top_z">吉林省飞跃汽车部件有限公司</div>
            <div class="top_fh" @click="fh">
                <p class="top_fh_1">返回</p>
            </div>
        </div>
        <div class="bottom">
            <div class="bottom_top">
                <div class="bottom_top_left">
                    <div class="bottom_top_left_bg">
                        <table>
                            <tr>
                                <th>企业名称</th>
                                <td>{{ Companydetails.firmName }}</td>
                            </tr>
                            <tr>
                                <th>企业法人</th>
                                <td>{{ Companydetails.firmUserName }}</td>
                            </tr>
                            <tr>
                                <th>总资产</th>
                                <td>{{ Companydetails.outputValue }}</td>
                            </tr>
                            <tr>
                                <th>占地面积</th>
                                <td>{{ Companydetails.floorSpace }}</td>
                            </tr>
                            <tr>
                                <th>主营业务</th>
                                <td>{{ Companydetails.hostIndustry }}</td>
                            </tr>
                            <tr>
                                <th>类别</th>
                                <td>{{ Companydetails.industryName }}</td>
                            </tr>
                            <tr>
                                <th>区域</th>
                                <td>{{ Companydetails.firmAreaName }}</td>
                            </tr>
                            <tr>
                                <th>2021年产值</th>
                                <td>{{ Companydetails.moneyCz }}</td>
                            </tr>
                            <tr>
                                <th>2022年1-6月产值</th>
                                <td>{{ Companydetails.sixCz }}</td>
                            </tr>
                            <tr>
                                <th>2021年税收</th>
                                <td>{{ Companydetails.moneySs }}</td>
                            </tr>
                            <tr>
                                <th>2022年1-6月税收</th>
                                <td>{{ Companydetails.sixSs }}</td>
                            </tr>
                            <tr>
                                <th>联系人</th>
                                <td>{{ Companydetails.gridman }}</td>
                            </tr>
                            <tr>
                                <th>电话</th>
                                <td>155xxxxxxxx</td>
                            </tr>
                        </table>
                    </div>
                </div>
                <div class="bottom_top_right">
                    <el-image style="width: 47%; height: 43%" :src="`http://139.224.69.209${item}`"
                        :preview-src-list="srcList" :initial-index="4" fit="cover"
                        v-for="item,       index in Companydetails.firmImgList" v-show="index       <       4" :key="index" />

                </div>
            </div>
            <div class="bottom_bottom">
                <div class="bottom_bottom_left">
                    <div class="bottom_bottom_left_tb">

                    </div>
                    <div class="bottom_bottom_left_zt" v-html="Companydetails.content">

                    </div>
                </div>
                <div class="bottom_bottom_right">
                    <div class="bottom_bottom_right_tb">

                    </div>
                    <div class="bottom_bottom_right_tbs" id="container">
                    </div>
                </div>
            </div>
        </div>
    </div>
</template>
<script setup>
import { useStore, mapState } from 'vuex'
import { computed, onMounted, ref, onBeforeUnmount } from 'vue'
const store = useStore()
const srcList = ref([])
const Companydetails = useStore().state.Companydetails
var map;
const fh = () => {
    store.commit('tcupdata', 0)
}

let longitude = Companydetails.longitude ? Companydetails.longitude : '116.397428'
let lat = Companydetails.dimension ? Companydetails.dimension : '39.90923'
const initMap = () => {
    map = new AMap.Map("container", {
        resizeEnable: true,
        viewMode: "2D",
        zoom: 18,
        center: [longitude, lat],
    });
    addMarker()
    //添加marker标记
    function addMarker() {
        var icon = new AMap.Icon({
            image: require("../../assets/imgs/bj.png"),
            anchor: "center",
        });
        var marker = new AMap.Marker({
            map,
            position: [longitude, lat],
            offset: new AMap.Pixel(-20, -25),
            icon: icon,
        });
        marker.setzIndex(100)
        var text = new AMap.Text({
            text: `
      <div class="bot" style="border-width: 20px;border-style: solid dashed dashed;
      border-color: red transparent transparent; left: 140px;bottom: -40px;width: 0;height: 0;
      font-size: 0;overflow: hidden;position: absolute;"> </div>
      <div class="top" style="border-width: 20px; border-style: solid dashed dashed;
      border-color: #ffffff transparent transparent;left: 140px;bottom: -37px;width: 0;height: 0;font-size: 0;
      overflow: hidden;position: absolute;"> </div>
      ${Companydetails.firmName}
`,
            anchor: "center", // 设置文本标记锚点
            offset: [20, -45],
            style: {
                width: "14rem",
                padding: ".75rem 1.25rem",
                background: "#fff",
                border: "2px solid red",
                "margin-top": "10px",
                'text-align': 'center',
                color: 'red',
                'font-weight': 'bolder'
            },
            position: [longitude, lat],
        });
        text.setMap(map);
    }

}

onMounted(() => {
    console.log(Companydetails);
    Companydetails.firmImgList.forEach(item => {
        item = `http://139.224.69.209${item}`
        srcList.value.push(item)
    })
    initMap()
})

onBeforeUnmount(() => {
    console.log(1111222);
    map.destroy()
})
</script>
<style scoped>
.body {
    width: 100%;
    height: 70%;
}

.top {
    width: 100%;
    height: 10%;
    background-image: url(../../assets/imgs/bt\ 拷贝\ 5.png);
    background-size: 100% 100%;
    overflow: hidden;
    display: flex;
}

.top_z {
    width: 90%;
    height: 100%;
    color: #fff;
    font-size: 2.5vw;
    margin: 0.3vw 2vw;
}

.top_fh {
    cursor: pointer;
    width: 7%;
    height: 50%;
    background-image: url(../../assets/imgs/返回.png);
    background-size: 100% 100%;
    float: right;
    color: #004098;
    margin-top: 1.6%;
}

.top_fh_1 {
    margin-left: 3vw;
    margin-top: 0.7vw;
    font-size: 0.2vw;
}

.bottom {
    width: 100%;
    height: 90%;
    border: 0.1vw solid #1d5bcc;
}

.bottom_top {
    width: 100%;
    height: 50%;
    display: flex;
}

.bottom_top_left {
    width: 50%;
    height: 100%;
}

.bottom_top_left_bg {
    width: 95%;
    height: 90%;
    background-image: url(../../assets/imgs/规上工业企业整体.png);
    background-size: 100% 100%;
    margin: 2% 2%;
}

table {
    width: 100%;
    height: 100%;
}

th {
    width: 30%;
}

th,
td {
    height: 1%;
    font-size: 0.1vw;
}

.bottom_top_right {
    width: 50%;
    height: 100%;
    margin-top: 0.5%;
}

.el-image {
    margin: 1% 0 0 2%;
}

.bottom_bottom {
    width: 100%;
    height: 50%;
    display: flex;
}

.bottom_bottom_left {
    width: 50%;
    height: 100%;
}

.bottom_bottom_left_zt {
    width: 100%;
    height: 90%;
    font-size: 1vw;
    line-height: 2.4vw;
    text-indent: 2.5vw;
    overflow-y: scroll;
}

.bottom_bottom_left_tb {
    width: 60%;
    height: 10%;
    background-image: url(../../assets/imgs/qybt.png);
    background-size: 100% 100%;
}

.bottom_bottom_right {
    width: 50%;
    height: 100%;
}

.bottom_bottom_right_tb {
    width: 60%;
    height: 10%;
    background-image: url(../../assets/imgs/gswz.png);
    background-size: 100% 100%;
}

.bottom_bottom_right_tbs {
    width: 99%;
    height: 87%;
    /* background-image: url(../../assets/imgs/公司位置整体.png); */
    /* background-size: 100% 100%; */
}

#container {
    margin-top: 1%;
}

/deep/.amap-info-content {
    border: 1px solid red;
}
</style>